home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
oocs
/
modgloba.bas
< prev
next >
Wrap
BASIC Source File
|
1999-09-06
|
3KB
|
139 lines
Attribute VB_Name = "modGlobals"
Option Explicit
' API Declres
Public Declare Function GetTickCount Lib "kernel32" () As Long
'--- Globals
Public Client_ As cClientActions
Public bReplied As Boolean
Public lTIme As Long
'--- This is the Start-Up Procedure
Sub Main()
' create the Client_ Object for use through out the application
' which will handle all winsock capabilities.
Set Client_ = New cClientActions
bReplied = False
frmCLient.Show
End Sub
'--- SendData() This function merely sends the data to the Server and handles
'--- it's own Errors.
Function SendData(sData As String) As Boolean
On Error GoTo ErrH
Dim TimeOut As Long
bReplied = False
frmCLient.tcpClient.SendData sData
Do Until (frmCLient.tcpClient.State = 0) Or (TimeOut < 10000)
DoEvents
TimeOut = TimeOut + 1
If TimeOut > 10000 Then Exit Do
Loop
SendData = True
Exit Function
ErrH:
SendData = False
MsgBox Err.Description, 16, "Error #" & Err.Number
DoCntrls False
frmCLient.mnuConnect.Enabled = True
FileCount False
StatusReport " Dissconnected!"
Exit Function
End Function
' --- updates a label
Sub StatusReport(sMsg As String)
frmCLient.lblCurCaption = sMsg
End Sub
Sub UpdateListBox(LstBox As Control, sAddThese As String)
Dim lStartPos As Long, SubStr As String
'The File Paths will be seperated by ";", so extract them
'one by one and add to the combo box of choice
lStartPos = InStr(1, sAddThese, ";")
While lStartPos > 0
SubStr = Mid$(sAddThese, 1, lStartPos - 1)
sAddThese = Mid$(sAddThese, lStartPos + 1)
lStartPos = InStr(1, sAddThese, ";")
LstBox.AddItem SubStr
Wend
End Sub
' --- a function for pausing
Sub Pause(HowLong As Long)
Dim u%, tick As Long
tick = GetTickCount
Do
u% = DoEvents
Loop Until tick + HowLong < GetTickCount
End Sub
' --- update the file count label
Sub FileCount(ShowIt As Boolean)
With frmCLient.lblFileCnt
If ShowIt Then
.Visible = True
Else
.Visible = False
End If
.Caption = Client_.NumFiles & " file(s) on the " & Client_.CurDrive & " Drive."
End With
End Sub
' --- Enables and disables the controls
Sub DoCntrls(CntrlState As Boolean)
With frmCLient
.cmdMsg.Enabled = CntrlState
.cmdRetrieve.Enabled = CntrlState
.cmdSysInfo.Enabled = CntrlState
.lblCap.Enabled = CntrlState
End With
End Sub
Public Sub DisplayInfo(sAddThese)
Dim lStartPos As Long, SubStr As String
Dim SysData(1 To 10) As String
Dim SysDirs(1 To 3) As String
Dim TempStor(1 To 9) As String
Dim xx As Integer
frmCLient.Picture1.Visible = True
'The File Paths will be seperated by ";", so extract them
'one by one and add to the combo box of choice
lStartPos = InStr(1, sAddThese, ";")
While lStartPos > 0
xx = xx + 1
SubStr = Mid$(sAddThese, 1, lStartPos - 1)
sAddThese = Mid$(sAddThese, lStartPos + 1)
lStartPos = InStr(1, sAddThese, ";")
frmCLient.Label(xx - 1) = SubStr
Wend
End Sub